"use client"

type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;

export const Button:React.FC<ButtonProps> = ({children, onClick}) => {

  const btnOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
    console.log(`btnOnClick on button '${(e.target as any)?.innerText}'`)
    onClick?.(e)
  }

  return (
    <button
      className="py-1 px-4 bg-indigo-500 text-white rounded-md shadow-md"
      onClick={btnOnClick}
    >
      {children}
    </button>
  )
}
